import {exportFunc} from '@/api/export.js'
/**
 * 
 * @param {String} headers 
 * @param {String} bucketName 存储桶名称
 * @param {String} attachPath 附件路径
 * @param {String} attachName 附件名称
 */
export const downloadFn = (headers,bucketName,attachPath,attachName) => {
  let filePath = ''
  if (attachPath.startsWith('http')) {
    filePath = attachPath.split(bucketName)[1]
  } else {
    filePath = attachPath
  }
  exportFunc('/blade-system/attach/downloadFile', headers, `bucket_name=${bucketName}&filePath=${filePath}`, attachName)
}